package deibay.server.commands;

import java.util.Vector;

import deibay.messages.Message;
import deibay.messages.SendItemsListMsg;
import deibay.messages.SendSellerItemsListMsg;
import deibay.server.ServerManager;
import deibay.server.eventargs.SendMessageEventArg;
import deibay.server.events.SendMessageEvent;
import deibay.users.User;

public class RequestSellerItemsListCommand extends Command{

	public RequestSellerItemsListCommand(User user, Message msg) {
		super(user, msg);		
	}

	@Override
	public void execute() {
		Vector<String> items = ServerManager.getInstance().getDataManager().getItemsBySeller(user.getId());
		SendSellerItemsListMsg msg = new SendSellerItemsListMsg(SendSellerItemsListMsg.class.getSimpleName(), items);		
		ServerManager.getInstance().getEventManager().fireEvent(new SendMessageEvent(new SendMessageEventArg(this.user.getId(), msg)));		
	}

}
